// Person（抽象类）
abstract class Person {
    name: string
    age: number
    constructor(name:string,age:number){
        this.name = name
        this.age = age
    }

    abstract speak(): void
}

// Teacher类继承Person
class Teacher extends Person {
    // 构造器
    constructor(name: string,age: number){
        super(name,age)
    }
    // ⽅法
    speak(){
        console.log('你好！我是⽼师:',this.name)
    }
}
// Student类继承Person
class Student extends Person {
    constructor(name: string,age: number){
        super(name,age)
    }

    speak(){
        console.log('你好！我是学生:',this.name)
    }

}
// Person实例
// const p1 = new Person('周杰伦',38) // 由于Person是抽象类，所以此处不可以new Person的实例对象

let teacher = new Teacher('纪宽豪', 40)
teacher.speak()
let stu = new Student('纪小豪', 40)
stu.speak()
